<?php

$manager = new \MongoDB\Driver\Manager("mongodb://admin:123456@127.0.0.1:27017/msg_center?authSource=admin&readPreference=primary&appname=MongoDB%20Compass&directConnection=true&ssl=false");


$filter = ['mobile' => '18600880450'];
$options = [
    'projection' => ['_id' => 0],
    'sort' => ['created_at' => -1],
];
$session=$manager->startSession(['causalConsistency'=>false]);
// 查询数据
$query = new MongoDB\Driver\Query($filter, $options);
$cursor = $manager->executeQuery('msg_center.sms_log', $query);


foreach ($cursor as $document) {
    print_r($document);
}
$session->endSession();;

